package com.face.photo.jsu;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
	public class photo {
			    int x=0;
			    public  void InputPath(String srcPath,String destPath) throws IOException  
			    {     
			    	String name;
			        File file1=new File(srcPath);
			        name=file1.getName();
			        destPath=destPath+"\\"+name;
			        System.out.println("存入地址为："+destPath);
			        FileInputStream fis = new FileInputStream(srcPath);
			        FileOutputStream fos = new FileOutputStream(destPath);
			      
			        int len = 0;
			    
			        byte[] b = new byte[1024];
			        while ((len = fis.read(b)) != -1) {
			            fos.write(b, 0, len);
			        }
			        
			      
			        fos.close(); 
			        fis.close(); 
			          
			        }
			    public void Close(String path)
			    {
			    	
			    	File file = new File(path);
			        File [] files = file.listFiles();
			        String [] names = file.list();
			        int x=0;
			        for(File a:files)
			        {
			            System.out.println(a.getName());
			            	 a.renameTo(new   File(path+"//"+(x+1)+".jpg"));
			            	 x++;
			            }
			    }
			    public void Begin(String path)
			    {
			    	File file = new File(path);
			    	 if(!file.exists())
			    	file.mkdir();
			        File [] files = file.listFiles();
			        String [] names = file.list();
			        int x=0;
			        for(File a:files)
			        {
			            a.delete();     
			        }
			    }

}
